package com.myapp.ruyixing.ui.widget;

import android.app.AlertDialog;
import android.app.Dialog;
import android.content.DialogInterface;
import android.content.DialogInterface.OnClickListener;
import android.os.Bundle;
import android.support.v4.app.DialogFragment;

public class PhotoTypePickFragment extends DialogFragment {

	@Override
	public Dialog onCreateDialog(Bundle savedInstanceState) {
		String[] items = new String[] { "拍照上传", "本地图库" };
		return new AlertDialog.Builder(getActivity()).setTitle("选择图片")
				.setItems(items, new OnClickListener() {

					@Override
					public void onClick(DialogInterface dialog, int which) {
						if (which == 0) {
							getFragmentManager()
									.beginTransaction()
									.add(PhotoPickFragment.getInstance(1),
											"fm_photo_pick").commit();
						} else if (which == 1) {
							getFragmentManager()
									.beginTransaction()
									.add(PhotoPickFragment.getInstance(2),
											"fm_photo_pick").commit();
						}

					}
				}).create();
	}
}
